package com.bocloud.cmp.web.controller.app.resource;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.bocloud.common.enums.BoCloudMethod;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BsmResult;
import com.bocloud.registry.http.core.ServiceFactory;
import com.bocloud.registry.http.model.RemoteService;
/**
 * 应用饼状图web 控制层
 * @author Zaney
 * @data:2017年4月4日
 * @describe:
 */
@RestController
@RequestMapping("/diagram")
public class DiagramController {
	private final String BASE_SERVICE = "/diagram";
	private static final BoCloudService SERVICE = BoCloudService.Cmp;
	@Autowired
	private ServiceFactory serviceFactory;
	
	@RequestMapping(value = "/data", method = { RequestMethod.GET })
	public BsmResult data(HttpServletRequest request){
		String url = BASE_SERVICE + "/data";
		RemoteService service = serviceFactory.safeBuild(SERVICE, url, BoCloudMethod.BASIC, null, null, request);
		return service.invoke();
	}
}
